<?php
my_component_load('testing' , false);
my_component_load('paging' , false);  
my_component_load('data_setting', false);
my_component_load('pr_sk_tunjangan' );
$task = isset($_GET['task']) ? $_GET['task'] : ""; 
$id = isset( $_GET['id'] ) ? $_GET['id']:  0;
$kg_id = isset( $_GET['kg_id'] ) ? $_GET['kg_id']:  0;
$sub_id = isset( $_GET['sub_id'] ) ? $_GET['sub_id']:  0;
$sk_id= isset( $_GET['sk_id'] ) ? $_GET['sk_id']:  0;
$modulname = "Admin _BN_ Konfigurasi Data _BN_ SK Tunjangan";
if($_SERVER['REQUEST_METHOD'] == "POST"){
	switch($task){
		case   "edit_sk_page" :
			$validatepost = form_sk_validate($id);
			if($validatepost){
				$errors = message_multi_error($validatepost);
				$content = $errors;
				$content .=form_sk($id);
				generate_my_web($content,"","plain.php");
				exit; 
			}else{
				$sk_id = submit_sk($id);
				my_direct('index.php?com='.$_GET['com'].'&task=newrapel&sk_id='.$sk_id);
				$content =  "Updated";
				generate_my_web($content,"","plain.php");
				exit;
			}	
			break;	
		case    "editrupiah_page" :
			submit_add_rupiah_create($sk_id,$kg_id,$sub_id);
			$content  = 'Updated!';
			generate_my_web($content,"","plain.php");
			exit; 
	}
}else{ 	
	if($task == "editrupiah"){
		$title= "Perubahan data nominal"  ;
		facebox_page('index.php?com=pr_sk_tunjangan&task=editrupiah_page
		&sk_id='.$sk_id.'&sub_id='.$sub_id.'&kg_id='.$kg_id , $title , 190	); 
	}elseif($task == "newrapel"){	
		$content  = form_rapel($sk_id);
		generate_my_web($content,"","plain.php");
		exit;
	}elseif($task == "editrupiah_page"){  
		$content  = form_add_rupiah_create($sk_id,$kg_id,$sub_id);
		generate_my_web($content,"","plain.php");
		exit; 
	}elseif($task=='list_detail'){
		$pagename = " ";
		$modulname = $modulname." _BN_ Detail";
		load_facebox_script();
		$view = list_detail($sk_id);
		
	}elseif($task == "edit_sk"){ 
		$pagename = ($id > 0 ) ? "Perubahan Data" : "Tambah Data";
		facebox_page('index.php?com='.$_GET['com'].'&task=edit_sk_page&id='.$id , $pagename , 260	);
	}elseif($task == "edit_sk_page"){
		$content = form_sk($id);
		generate_my_web($content, '' ,"plain.php");
		exit;
	}elseif($task == 'deletesk'){ 
		delete_sk($id);
		my_direct('index.php?com='.$_GET['com']);		
	}else{
		$pagename = "Daftar SK Tunjangan";
		load_facebox_script();
		$view =  list_sk() ; 
		$href='index.php?com='.$_GET['com'].'&task=edit_sk';
	}
}
$content = spliter_browser( $view , $pagename ,null);
generate_my_web($content, $modulname );

?>